package com.video.web.controller.video;

import com.video.video.domain.RegisterSettings;
import com.video.video.service.IRegisterSettingsService;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.video.common.annotation.Log;
import com.video.common.core.controller.BaseController;
import com.video.common.core.domain.AjaxResult;
import com.video.common.enums.BusinessType;
import com.video.common.utils.poi.ExcelUtil;
import com.video.common.core.page.TableDataInfo;

/**
 * APP注册设置Controller
 *
 * @author ruoyi
 * @date 2023-03-20
 */
@RestController
@RequestMapping("/video/RegisterSettings")
public class RegisterSettingsController extends BaseController
{
    @Autowired
    private IRegisterSettingsService registerSettingsService;

    /**
     * 查询APP注册设置列表
     */
    @PreAuthorize("@ss.hasPermi('video:RegisterSettings:list')")
    @GetMapping("/list")
    public TableDataInfo list(RegisterSettings registerSettings)
    {
        startPage();
        List<RegisterSettings> list = registerSettingsService.selectRegisterSettingsList(registerSettings);
        return getDataTable(list);
    }

    /**
     * 导出APP注册设置列表
     */
    @PreAuthorize("@ss.hasPermi('video:RegisterSettings:export')")
    @Log(title = "APP注册设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RegisterSettings registerSettings)
    {
        List<RegisterSettings> list = registerSettingsService.selectRegisterSettingsList(registerSettings);
        ExcelUtil<RegisterSettings> util = new ExcelUtil<RegisterSettings>(RegisterSettings.class);
        util.exportExcel(response, list, "APP注册设置数据");
    }

    /**
     * 获取APP注册设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('video:RegisterSettings:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(registerSettingsService.selectRegisterSettingsById(id));
    }

    /**
     * 新增APP注册设置
     */
    @PreAuthorize("@ss.hasPermi('video:RegisterSettings:add')")
    @Log(title = "APP注册设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RegisterSettings registerSettings)
    {
        return toAjax(registerSettingsService.insertRegisterSettings(registerSettings));
    }

    /**
     * 修改APP注册设置
     */
    @PreAuthorize("@ss.hasPermi('video:RegisterSettings:edit')")
    @Log(title = "APP注册设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RegisterSettings registerSettings)
    {
        return toAjax(registerSettingsService.updateRegisterSettings(registerSettings));
    }

    /**
     * 删除APP注册设置
     */
    @PreAuthorize("@ss.hasPermi('video:RegisterSettings:remove')")
    @Log(title = "APP注册设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(registerSettingsService.deleteRegisterSettingsByIds(ids));
    }
}
